<?php
/**
 * This is a Category model test.
 *
 * @copyright     Copyright 2008-2010, LilCake.net
 * @link          http://lilcake.net LilCake.net
 * @package       lil_blogs
 * @subpackage    lil_blogs.tests.cases.models
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
App::import('Model', 'LilBlogs.Category');
/**
 * CategoryTestCase class
 *
 * @uses          CakeTestCase
 * @package       lil_blogs
 * @subpackage    lil_blogs.tests.cases.models
 */
class CategoryTestCase extends CakeTestCase {
/**
 * Category property
 *
 * @var object
 * @access public
 */
	var $Category = null;
/**
 * fixtures property
 *
 * @var array
 * @access public
 */
	var $fixtures = array(
		'plugin.lil.user', 'plugin.lil.area', 'plugin.lil.areas_user',
		'plugin.lil_blogs.category', 'plugin.lil_blogs.post',
		'plugin.lil_blogs.categories_post'
	);
/**
 * start method
 *
 * @access public
 * @return void
 */
	function start() {
		// reset all variables
		require APP . 'plugins' . DS . 'lil' . DS . 'config' . DS . 'core.php';
		require APP . 'plugins' . DS . 'lil_blogs' . DS . 'config' . DS . 'core.php';
		
		parent::start();
		$this->Category =& ClassRegistry::init('Category');
	}
/**
 * testCategoryInstance method
 *
 * @access public
 * @return void
 */
	function testCategoryInstance() {
		$this->assertTrue(is_a($this->Category, 'Category'));
	}
/**
 * testCategoryFind method
 *
 * @access public
 * @return void
 */
	function testCategoryFind() {
		$results = $this->Category->recursive = -1;
		$results = $this->Category->find('first');
		$this->assertTrue(!empty($results));
		
		$expected = array('Category' => array(
			'id'  => 1,
			'blog_id'  => 1,
			'parent_id' => null,
			'lft' => 1,
			'rght' => 2,
			'slug' => 'programming',
			'name'  => 'Programming',
			'created'  => '2008-01-23 12:34:56',
			'modified'  => '2008-03-21 12:34:56'
		));
		$this->assertEqual($results, $expected);
	}
}
?>